<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    function getMaxAndMin(arr) {
      var max = arr[0];
      var min = arr[0];
      for (var i=1; i < arr.length; i++) {
        if (max < arr[i]) {
          max = arr[i];
        }
        if (min > arr[i]) {
          min = arr[i];
        }
      }
      return '最大值是：' + max + ',最小值是：' + min;
    }
    console.log(getMaxAndMin([23,4324,22,432,1,233]));
  </script>
</body>
</html>